package com.ruoyi.project.drug.service.impl;

import com.ruoyi.project.drug.domain.Supplier;
import com.ruoyi.project.drug.mapper.SupplierMapper;
import com.ruoyi.project.drug.service.ISupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class SupplierServiceImpl implements ISupplierService {
    @Autowired
    private SupplierMapper supplierMapper;
    @Override
    public List<Supplier> getSuppliers(Supplier supplier) {
        return supplierMapper.selectSuppliers(supplier);
    }

    @Override
    public int insertSupplier(Supplier supplier) {
        supplier.setCreateTime(new Date());
        return supplierMapper.newSupplier(supplier);
    }

    @Override
    public Supplier getById(Long supId) {
        return supplierMapper.findSupplier(supId);
    }

    @Override
    public int alterSupplier(Supplier supplier) {
        return supplierMapper.changeSupplier(supplier);
    }

    @Override
    public int deleteSupplier(Long[] supIds) {
        return supplierMapper.dropSupplier(supIds);
    }

    @Override
    public List<Supplier> menuSupplier() {
        return supplierMapper.allSupplier();
    }
}
